window.onload = function(){
	//点击领取实体书
	var oVoteBtn = document.getElementById("voteBtn");
	var oAlertBody = document.getElementById("alertBody");
	var oAlertRule = document.getElementById("alertRule");
	var oVoteRule = document.getElementById("voteRule");
	var oVoteRuleBtn = document.getElementById("voteRuleBtn");
	var alertBg = document.getElementById("alertBg");
	var closeVote = document.getElementById("closeVote");
	oAlertRule.onclick = function(){
		alertBg.style.display = "block";
		oVoteRule.style.display = "block";
	}
	oVoteBtn.onclick = function(){
		alertBg.style.display = "block";
		oAlertBody.style.display = "block";
	}
	oVoteRuleBtn.onclick = function(){
		alertBg.style.display = "none";
		oVoteRule.style.display = "none";
	}
	alertBg.onclick = function(){
		alertBg.style.display = "none";
		oVoteRule.style.display = "none";
		oAlertBody.style.display = "none";
	}
	closeVote.onclick = function(){
		alertBg.style.display = "none";
		oAlertBody.style.display = "none";
	}
	//投票规则字颜色
	window.setInterval(function(){
		if(!oAlertRule.className){
			oAlertRule.className = "isShow"
		}else{
			oAlertRule.className = ""
		}
	},300)
	
	
	
	//弹幕
	var oVoteUser1 = document.getElementById("VoteUser1");
	var scrollWidth1 = oVoteUser1.offsetWidth;
	
	var oVoteUser2 = document.getElementById("VoteUser2");
	var scrollWidth2 = oVoteUser2.offsetWidth;
	
	var oVoteUser3 = document.getElementById("VoteUser3");
	var scrollWidth3 = oVoteUser3.offsetWidth;
	
	
	window.setInterval(function(){
		var s=0;
		var scrollLeft1 = oVoteUser1.offsetLeft;
		var scrollLeft2 = oVoteUser2.offsetLeft;
		var scrollLeft3 = oVoteUser3.offsetLeft;
		//弹幕判断
		if(scrollLeft1<-scrollWidth1){
			oVoteUser1.style.left = "100%";
		}else{
			s -= 3;
			var val1 = scrollLeft1 + s;
			var valr1 = val1 + "px";
			oVoteUser1.style.left = valr1;
		}
		
		if(scrollLeft2<-scrollWidth2){
			oVoteUser2.style.left = "100%";
		}else{
			s += 1;
			var val2 = scrollLeft2 + s;
			var valr2 = val2 + "px";
			oVoteUser2.style.left = valr2;
		}
		
		if(scrollLeft3<-scrollWidth3){
			oVoteUser3.style.left = "100%";
		}else{
			s -= 2;
			var val3 = scrollLeft3 + s;
			var valr3 = val3 + "px";
			oVoteUser3.style.left = valr3;
		}
		//console.log(scrollLeft1)//边界
		//console.log(scrollWidth1)//宽度
	},40)

	
}